<?php
require ('configuration.html');

if(isset($_POST['InputFeld1'])){  
   // Abfrage mit like %string%
    $sql = "SELECT distinct canword from germanspanish WHERE canword LIKE '%". $_POST['InputFeld1'] . "%' ";
    // DB Init
//    $db_link = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD); 
    $db_sel = mysql_select_db( MYSQL_DATABASE ) or die("Error database access"); 
    // DB Query    
    $db_res = mysql_query( $sql );
    if ( ! $db_res ) { die('Error query: ' . mysql_error()); }

   // z.B. Ergebnisse werden in einem Array gespeichert
   echo '<ul>';
   while ($row = mysql_fetch_array( $db_res, MYSQL_ASSOC)) {
      $row['canword'] = utf8_encode($row['canword']);
      echo '<li>'. $row['canword'] . '</li>';
   }
   echo '</ul>';
}
if(isset($_POST['InputFeld2'])){
   // Abfrage mit like %string%
    $sql = "SELECT distinct learnword from germanspanish WHERE learnword LIKE '%". $_POST['InputFeld2'] . "%' ";
    // DB Init
//    $db_link = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD);
    $db_sel = mysql_select_db( MYSQL_DATABASE ) or die("Error database access");
    // DB Query
    $db_res = mysql_query( $sql );
    if ( ! $db_res ) { die('Error query: ' . mysql_error()); }

   // z.B. Ergebnisse werden in einem Array gespeichert
   echo '<ul>';
   while ($row = mysql_fetch_array( $db_res, MYSQL_ASSOC)) {
      $row['learnword'] = utf8_encode($row['learnword']);
      echo '<li>'. $row['learnword'] . '</li>';
   }
   echo '</ul>';
}
if(isset($_POST['InputFeld3'])){
   // Abfrage mit like %string%
    $sql = "SELECT distinct canword from germanenglish WHERE canword LIKE '%". $_POST['InputFeld3'] . "%' ";
    // DB Init
//    $db_link = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD);
    $db_sel = mysql_select_db( MYSQL_DATABASE ) or die("Error database access");
    // DB Query
    $db_res = mysql_query( $sql );
    if ( ! $db_res ) { die('Error query: ' . mysql_error()); }

   // z.B. Ergebnisse werden in einem Array gespeichert
   echo '<ul>';
   while ($row = mysql_fetch_array( $db_res, MYSQL_ASSOC)) {
      $row['canword'] = $row['canword'];
      echo '<li>'. $row['canword'] . '</li>';
   }
   echo '</ul>';
}
if(isset($_POST['InputFeld4'])){
   // Abfrage mit like %string%
    $sql = "SELECT distinct learnword from germanenglish WHERE learnword LIKE '%". $_POST['InputFeld4'] . "%' ";
    // DB Init
//    $db_link = mysql_connect (MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD);
    $db_sel = mysql_select_db( MYSQL_DATABASE ) or die("Error database access");
    // DB Query
    $db_res = mysql_query( $sql );
    if ( ! $db_res ) { die('Error query: ' . mysql_error()); }

   // z.B. Ergebnisse werden in einem Array gespeichert
   echo '<ul>';
   while ($row = mysql_fetch_array( $db_res, MYSQL_ASSOC)) {
      $row['learnword'] = utf8_encode($row['learnword']);
      echo '<li>'. $row['learnword'] . '</li>';
   }
   echo '</ul>';
}

?>